function get() {
  $.ajax({
    url: '/admin/comments',
    success: function (res) {
      // console.log(1111)
      let tpl = template('tpl-list', res)
      // console.log(tpl)
      $("tbody").html(tpl)
    }
  })
};
get();

// ---------------删除--------------------------
$('tbody').on('click', '.del', function (e) {
  e.preventDefault();
  let id = $(this).data('id')
  // console.log(id)
  layer.confirm("确认是否要删除", function (index) {
    $.ajax({
      url: '/admin/comments/' + id,
      type: 'DELETE',
      success: function (res) {
        // console.log(res)
        layer.msg(res.message)
        if (res.status === 0) {
          get();
        }
      }
    })
  })
})



